/* eslint-disable */
/**
 * Created by GYL on 2018/8/24
 */
//新增主体
import React, { Component } from 'react';
import styles from '../index.less';
import { Collapse, Icon, Select, Input, Tooltip, Form, Row, Col, TreeSelect, Tag, message, Divider, Steps, Popover, Spin, Button } from 'antd';
import PublicService from "../../../services/PublicService";
import config from '../../../config';
import Util from '../../../utils/Util';
import request from '../../../utils/request';

import AddEvent from './AddEvent';
const { Step } = Steps;
const { TextArea } = Input;
const { SHOW_CHILD } = TreeSelect;
var indexNum
var fengxianArr = []
const IconFont = Icon.createFromIconfontCN({
    scriptUrl: '//at.alicdn.com/t/font_1315525_8ark569k0xh.js',
});
class Add_Wrap extends Component {

    constructor(props) {
        super(props)
        this.state = {
            eventBasicId: '',//事件id
            Task: [],
            getTreeDataAn: [],//安全提示部门下拉树
            treeArr1: [],//子责任部门
            TaskData: {},//前置任务传入数组,为新增表格数据
            selectedRowKeys: [],
            arr: [
                {
                    type: 'title',
                    name: "基本信息",
                    span: 24,
                    backgroundColor: '#206bdc',
                    color: '#206bdc',
                    marginTop: 10,
                    height: 30
                },
                {
                    type: 'TextArea',
                    paramName: 'eventBasicName',
                    id: 'eventBasicName',
                    title: '0/30',
                    num: 30,
                    key: "eventBasicName",
                    label: '事件名称',
                    style: { width: 228 },
                    rules: [{ ...config.reg.required }],
                    span: 8,
                    rows: 2,
                    placeholder: '请输入事件名称',
                    // shuoming: styles.shijianmingcheng,
                    backgroundColor: '#1aaef517'

                },
                {
                    type: 'TextArea',
                    paramName: 'eventBasicDescribe',
                    id: 'eventBasicDescribe',
                    title: '0/200',
                    num: 200,
                    key: "eventBasicDescribe",
                    label: '事件说明',
                    style: { width: 608 },
                    rules: [{ ...config.reg.required }],
                    span: 16,
                    rows: 2,
                    placeholder: '请输入事件说明',
                    backgroundColor: '#1aaef517',
                    shuoming: styles.shuoming
                },
                {
                    type: 'select',
                    paramName: 'superior',
                    id: 'superior',
                    key: "superior",
                    label: '事件顺序',
                    rules: [{ ...config.reg.required }],
                    style: { width: 228 },
                    span: 8,
                    placeholder: '请选择',
                    backgroundColor: '#1aaef517',
                    shuoming: styles.shijianshangji,
                    options: [
                        { text: '无', value: '0' },
                        ...this.props.AddArr
                    ]
                },
                {
                    type: 'select',
                    paramName: 'eventBasicAttribute',
                    id: 'eventBasicAttribute',
                    key: "eventBasicAttribute",
                    label: '事件属性',
                    rules: [{ ...config.reg.required }],
                    span: 8,
                    style: { width: 228 },
                    shuoming: styles.shijianshuxing,
                    placeholder: '请选择',
                    backgroundColor: '#1aaef517',
                    options: [
                        { text: '必选项', value: '1' },
                        { text: '非必选项', value: '2' },
                    ]
                },
                {
                    type: 'select',
                    paramName: 'eventBasicStage',
                    id: 'eventBasicStage',
                    key: "eventBasicStage",
                    label: '事件阶段',
                    style: { width: 228 },
                    shuoming: styles.shijianjieduan,
                    rules: [{ ...config.reg.required }],
                    span: 8,
                    backgroundColor: '#1aaef517',
                    placeholder: '请选择',
                    options: [
                        { text: '项目前期', value: '1' },
                        { text: '项目实施', value: '2' },
                        { text: '项目验收', value: '3' },
                        { text: '项目结算', value: '4' },
                    ]
                },




                // {
                //     type: 'title',
                //     name: "安全信息",
                //     span: 24,
                //     backgroundColor: '#1fd02e',
                //     color: '#1fd02e',
                //     marginTop: 10,
                //     height: 30
                // },
                // {
                //     type: 'TextArea',
                //     paramName: 'safetyInformation',
                //     id: 'safetyInformation',
                //     title: '0/200',
                //     num: 200,
                //     key: "safetyInformation",
                //     label: '安全信息/防护措施',
                //     rules: [{ ...config.reg.required }],
                //     span: 12,
                //     rows: 2,
                //     style: { width: 500 },
                //     className: styles.anquan,
                //     backgroundColor: '#1aaef517',
                //     shuoming: styles.anquanxinxi,
                // },
                // {
                //     type: 'treeSelect',
                //     paramName: 'safetyInformationList',
                //     id: 'safetyInformationList',
                //     title: '0/200',
                //     num: 200,
                //     key: "safetyInformationList",
                //     label: '安全提示部门',
                //     rules: [{ ...config.reg.required }],
                //     treeCheckable: true,
                //     span: 12,
                //     rows: 2,
                //     maxTagCount: 5,
                //     style: { width: 500 },
                //     shuoming: styles.anquanxinxi,
                //     backgroundColor: '#1aaef517',
                //     className: styles.safetyInformationList,
                //     treeData: []
                // },
                {
                    type: 'title',
                    name: "风险信息",
                    span: 24,
                    backgroundColor: '#dc8a20',
                    color: '#dc8a20',
                    marginTop: 10,
                    height: 30
                },

                {
                    type: 'arr',
                    list: [
                        {
                            type: 'TextArea',
                            paramName: '1fengxian',
                            id: '1fengxian',
                            title: '0/100',
                            num: 100,
                            key: "1fengxian",
                            label: '#1风险信息',
                            rules: [{ ...config.reg.required }],
                            placeholder: '请输入风险信息',
                            span: 12,
                            rows: 2,
                            index: 1,
                            style: { width: 500 },
                            className: styles.fengxian,
                            backgroundColor: '#1aaef517',
                            shuoming: styles.anquanxinxi,
                            disabled: false
                        },
                        {
                            type: 'TextArea',
                            paramName: '1cuosi',
                            id: '1cuosi',
                            title: '0/100',
                            num: 100,
                            key: "1cuosi",
                            label: '#1对应措施',
                            placeholder: '请输入对应措施',
                            rules: [{ ...config.reg.required }],
                            span: 12,
                            rows: 2,
                            index: 1,
                            style: { width: 500 },
                            className: styles.cuoshi,
                            backgroundColor: '#1aaef517',
                            shuoming: styles.duiyingcuoshi,
                            disabled: false
                        },
                        {
                            type: 'delete',
                            span: 1,
                            index: 1,
                        }

                    ]
                },
                {
                    type: 'button',
                    span: 1,
                    pull: 2
                },
                {
                    type: 'title',
                    name: "子事件信息",
                    span: 24,
                    backgroundColor: '#5f5b5b',
                    color: '#5f5b5b',
                    marginTop: 0,
                    height: 30
                },

            ],
            roleIdArr: [],
            expandIconPosition: 'left',
            title: '添加子事件',
            subEvent: false,
            subEventArr: [],
            indexNum: 1,
            TaskArr: [],
            MyModal1Visible: false,
            spanLoading: false

        };
    }



    componentDidMount() {

        indexNum = this.state.indexNum;
        //新增进入获取子事件UU id
        request({
            url: '/pm-web/projectmanage/eventbasicinfo/getUUID',
            method: 'POST',
            data: {}
        }).then(data => {
            if (data.rc === 0) {
                // console.log(data)
                this.setState({
                    eventBasicId: data.ret
                })
                PublicService.setCookie('eventBasicId', data.ret);
            }
        })


        //获取安全提示部门选择下拉树
        request({
            url: '/pm-web/projectmanage/role/getTreeData',
            method: 'POST',
            data: { notManagementLayer: true }
        }).then(data => {
            this.setState({
                getTreeDataAn: data.ret,
            })

        })
        //查询子责任部门

        request({
            url: '/pm-web/projectmanage/role/getTreeData',
            method: 'POST',
            data: { parentId: "", roleLevel: 1, notManagementLayer: true }
        }).then(data => {
            // console.log(data)

            this.setState({
                arr: this.state.arr,
                treeArr1: data.ret,

            })

        })
    }

    componentWillUnmount() {
        this.setState({
            eventBasicId: '',//事件id
            Task: [],
            getTreeDataAn: [],//安全提示部门下拉树
            treeArr1: [],//子责任部门
            TaskData: {},//前置任务传入数组,为新增表格数据
            selectedRowKeys: [],
            arr: [
                {
                    type: 'title',
                    name: "基本信息",
                    span: 24,
                    backgroundColor: '#206bdc',
                    color: '#206bdc',
                    marginTop: 10,
                    height: 30
                },
                {
                    type: 'TextArea',
                    paramName: 'eventBasicName',
                    id: 'eventBasicName',
                    title: '0/30',
                    num: 30,
                    key: "eventBasicName",
                    label: '事件名称',
                    style: { width: 228 },
                    rules: [{ ...config.reg.required }],
                    span: 8,
                    rows: 2,
                    placeholder: '请输入事件名称',
                    // shuoming: styles.shijianmingcheng,
                    backgroundColor: '#1aaef517'

                },
                {
                    type: 'TextArea',
                    paramName: 'eventBasicDescribe',
                    id: 'eventBasicDescribe',
                    title: '0/200',
                    num: 200,
                    key: "eventBasicDescribe",
                    label: '事件说明',
                    style: { width: 608 },
                    rules: [{ ...config.reg.required }],
                    span: 16,
                    rows: 2,
                    placeholder: '请输入事件说明',
                    backgroundColor: '#1aaef517',
                    shuoming: styles.shuoming
                },
                {
                    type: 'select',
                    paramName: 'superior',
                    id: 'superior',
                    key: "superior",
                    label: '事件顺序',
                    rules: [{ ...config.reg.required }],
                    style: { width: 228 },
                    span: 8,
                    placeholder: '请选择',
                    backgroundColor: '#1aaef517',
                    shuoming: styles.shijianshangji,
                    options: [
                        { text: '无', value: '0' },
                        ...this.props.AddArr
                    ]
                },
                {
                    type: 'select',
                    paramName: 'eventBasicAttribute',
                    id: 'eventBasicAttribute',
                    key: "eventBasicAttribute",
                    label: '事件属性',
                    rules: [{ ...config.reg.required }],
                    span: 8,
                    style: { width: 228 },
                    shuoming: styles.shijianshuxing,
                    placeholder: '请选择',
                    backgroundColor: '#1aaef517',
                    options: [
                        { text: '必选项', value: '1' },
                        { text: '非必选项', value: '2' },
                    ]
                },
                {
                    type: 'select',
                    paramName: 'eventBasicStage',
                    id: 'eventBasicStage',
                    key: "eventBasicStage",
                    label: '事件阶段',
                    style: { width: 228 },
                    shuoming: styles.shijianjieduan,
                    rules: [{ ...config.reg.required }],
                    span: 8,
                    backgroundColor: '#1aaef517',
                    placeholder: '请选择',
                    options: [
                        { text: '项目前期', value: '1' },
                        { text: '项目实施', value: '2' },
                        { text: '项目验收', value: '3' },
                        { text: '项目结算', value: '4' },
                    ]
                },




                // {
                //     type: 'title',
                //     name: "安全信息",
                //     span: 24,
                //     backgroundColor: '#1fd02e',
                //     color: '#1fd02e',
                //     marginTop: 10,
                //     height: 30
                // },
                // {
                //     type: 'TextArea',
                //     paramName: 'safetyInformation',
                //     id: 'safetyInformation',
                //     title: '0/200',
                //     num: 200,
                //     key: "safetyInformation",
                //     label: '安全信息/防护措施',
                //     rules: [{ ...config.reg.required }],
                //     span: 12,
                //     rows: 2,
                //     style: { width: 500 },
                //     className: styles.anquan,
                //     backgroundColor: '#1aaef517',
                //     shuoming: styles.anquanxinxi,
                // },
                // {
                //     type: 'treeSelect',
                //     paramName: 'safetyInformationList',
                //     id: 'safetyInformationList',
                //     title: '0/200',
                //     num: 200,
                //     key: "safetyInformationList",
                //     label: '安全提示部门',
                //     rules: [{ ...config.reg.required }],
                //     treeCheckable: true,
                //     span: 12,
                //     rows: 2,
                //     maxTagCount: 5,
                //     style: { width: 500 },
                //     shuoming: styles.anquanxinxi,
                //     backgroundColor: '#1aaef517',
                //     className: styles.safetyInformationList,
                //     treeData: []
                // },
                {
                    type: 'title',
                    name: "风险信息",
                    span: 24,
                    backgroundColor: '#dc8a20',
                    color: '#dc8a20',
                    marginTop: 10,
                    height: 30
                },

                {
                    type: 'arr',
                    list: [
                        {
                            type: 'TextArea',
                            paramName: '1fengxian',
                            id: '1fengxian',
                            title: '0/100',
                            num: 100,
                            key: "1fengxian",
                            label: '#1风险信息',
                            rules: [{ ...config.reg.required }],
                            placeholder: '请输入风险信息',
                            span: 12,
                            rows: 2,
                            index: 1,
                            style: { width: 500 },
                            className: styles.fengxian,
                            backgroundColor: '#1aaef517',
                            shuoming: styles.anquanxinxi,
                            disabled: false
                        },
                        {
                            type: 'TextArea',
                            paramName: '1cuosi',
                            id: '1cuosi',
                            title: '0/100',
                            num: 100,
                            key: "1cuosi",
                            label: '#1对应措施',
                            placeholder: '请输入对应措施',
                            rules: [{ ...config.reg.required }],
                            span: 12,
                            rows: 2,
                            index: 1,
                            style: { width: 500 },
                            className: styles.cuoshi,
                            backgroundColor: '#1aaef517',
                            shuoming: styles.duiyingcuoshi,
                            disabled: false
                        },
                        {
                            type: 'delete',
                            span: 1,
                            index: 1,
                        }

                    ]
                },
                {
                    type: 'button',
                    span: 1,
                    pull: 2
                },
                {
                    type: 'title',
                    name: "子事件信息",
                    span: 24,
                    backgroundColor: '#5f5b5b',
                    color: '#5f5b5b',
                    marginTop: 0,
                    height: 30
                },

            ],
            roleIdArr: [],
            expandIconPosition: 'left',
            title: '添加子事件',
            subEvent: false,
            subEventArr: [],

            TaskArr: [],
            MyModal1Visible: false,
            spanLoading: false
        })

    }






    //计算文本域内数字个数
    onChangeNum = (v) => {
        var strs = getByteLen(v);
        function getByteLen(val) {
            strs = val
            return strs;
        }
        return strs.length

    }
    // 取消保存
    ModalCancel = (type) => {
        let t = this;
        t.setState({
            [type]: false,
            modalBtnLoading: false
        })
    };



    // 筛选条件组件change事件
    getChangeValue = (value, e) => {
        let t = this;
        let params = {};
        params[value] = e.target.value;
        t.setState({ params });
        //form表单赋值-----改变文本域数字个数
        this.props.form.setFieldsValue({ [value]: e.target.value })
        this.addChange(value, e.target.value.length)


    }



    getChangeValueList = (value, e) => {
        let t = this;
        let params = {};
        params[value] = e.target.value;
        t.setState({ params });
        //form表单赋值-----改变文本域数字个数
        this.props.form.setFieldsValue({ [value]: e.target.value })
        this.addChangeList(value, e.target.value.length)


    }

    addChangeList = (v, num) => {
        this.state.arr[7].list.forEach(item => {
            if (item.paramName === v) {
                item.title = `${num}/${item.num}`
            }
        });
    }

    addChangeSon = (v, num, index) => {
        this.state.sonArr[index].sonArrList.forEach(item => {
            if (item.paramName === v) {
                item.title = `${num}/${item.num}`
            }
        });
    }
    //新增改变tooplie的显示文字
    addChange = (v, num) => {
        this.state.arr.forEach(item => {
            if (item.paramName === v) {
                item.title = `${num}/${item.num}`
            }
        });
    }

    //保存按钮事件
    onModalSave = () => {
        let riskProtectionList = []
        let riskProtectionList1 = []
        this.props.form.validateFields((errors, values) => {
            if (!errors) {
                //查询子事件权重之和
                request({
                    url: '/pm-web/projectmanage/eventbasicinfo/getWeight',
                    method: 'POST',
                    data: { eventBasicId: this.state.eventBasicId }
                }).then(data => {
                    // console.log(data)
                    if (data.rc === 0) {
                        if (data.ret == 1) {
                            for (var i in values) {
                                // console.log()
                                if (i.indexOf('cuo') > 0) {
                                    if (values[i]) {
                                        riskProtectionList.push({
                                            riskName: values[i],
                                        })
                                    }

                                }
                                if (i.indexOf('fengxian') > 0) {
                                    if (values[i]) {
                                        riskProtectionList1.push({
                                            measures: values[i],
                                        })
                                    }

                                }
                            }
                            setTimeout(() => {
                                let arr = []
                                // let safetyInformationList = []
                                let knowledgeBaseList = []
                                riskProtectionList.forEach((item, index) => {
                                    arr.push({
                                        riskName: riskProtectionList[index].riskName,
                                        measures: riskProtectionList1[index].measures
                                    })
                                });
                                //循环风险信息
                                fengxianArr.forEach((item, index) => {
                                    arr.splice(item - 1, 1)
                                })
                                //总体事件
                                values.riskProtectionList = arr
                                values.creator = PublicService.getCookie('userId');
                                values.lastChanger = PublicService.getCookie('userId');
                                values.eventBasicId = this.state.eventBasicId//打开页面时保存的uu id
                                values.safetyInformationIdList = values.safetyInformationList
                                values.safetyInformationList = []
                                this.setState({
                                    spanLoading: true
                                })
                                request({
                                    url: '/pm-web/projectmanage/eventbasicinfo/insertEventBasicInfo',
                                    method: 'POST',
                                    data: values
                                }).then(data => {
                                    // console.log(data)
                                    if (data.rc === 0) {
                                        message.success('新增成功!')
                                        this.props.fanhui()
                                    } else {
                                        message.warning('新增失败!')
                                    }

                                    this.setState({
                                        spanLoading: false
                                    })

                                })


                            }, 500)

                        } else {
                            message.warning(data.ret>0?`当前子事件权重之和为${data.ret},请重新设置权重后保存`:'请先保存子事件!')
                        }
                    }
                })
            }
        });

    }


    selectedChange(fun, nextParams, paramName, index, value) {
        // console.log(fun, nextParams, paramName, index, value)


        let t = this;
        let params = {};
        params[paramName] = value;
        if (paramName) {
            t.setState({ params }, () => {
            });
        }
        if (typeof fun === "function") {
            fun(value);
            if (nextParams)
                t.props.form.setFieldsValue({
                    [nextParams]: ''
                })
        }
    }

    //新增风险信息
    addListfx = () => {

        indexNum++;
        this.state.arr[7].list.push(

            {
                type: 'TextArea',
                paramName: (new Date()).valueOf() + 'fengxian',
                id: (new Date()).valueOf() + 'fengxian',
                title: '0/100',
                num: 100,
                key: (new Date()).valueOf() + 'fengxian',
                label: `#${indexNum}风险信息`,
                placeholder: '请输入风险信息',
                rules: [{ ...config.reg.required }],
                span: 12,
                rows: 2,
                index: indexNum,
                style: { width: 500 },
                className: styles.fengxian,
                backgroundColor: '#1aaef517',
                shuoming: styles.anquanxinxi,
                disabled: false
            },
            {
                type: 'TextArea',
                paramName: (new Date()).valueOf() + 'cuoshi',
                id: (new Date()).valueOf() + 'cuoshi',
                title: '0/100',
                num: 100,
                key: (new Date()).valueOf() + 'cuoshi',
                label: `#${indexNum}对应措施`,
                placeholder: '请输入对应措施',
                rules: [{ ...config.reg.required }],
                span: 12,
                rows: 2,
                index: indexNum,
                style: { width: 500 },
                className: styles.cuoshi,
                backgroundColor: '#1aaef517',
                shuoming: styles.duiyingcuoshi,
                disabled: false
            },
            {
                type: 'delete',
                span: 2,
                index: indexNum,
            }

        )

        setTimeout(() => {
            this.setState({
                arr: this.state.arr
            })
        }, 200)
    }


    //编辑保存
    onModalSave2 = (v, index) => {


        v.assistanceDepartmentRoleIdList = v.assistanceDepartmentRoles
        v.eventAuditRoleIdList = v.eventAuditRoleList
        v.eventAuditCCRoleIdList = v.eventAuditCCRoleList
        v.assistanceDepartmentRoles = []
        v.eventAuditCCRoleList = []
        v.eventAuditRoleList = []


        v.sureWay = v.sureWay === '用户勾选' ? 1 : 2
        v.auditWay = v.auditWay === '不需审核' ? 1 : v.auditWay === '系统内审核' ? 2 : v.auditWay === '系统内抄送' ? 3 : 4
        v.subeventsBasicWeight = Number(v.subeventsBasicWeight)

    }



    //多选
    onSelectChange = (selectedRowKeys, row) => {
        // console.log(selectedRowKeys, row)
        this.setState({ selectedRowKeys, row })
    };


    fanhui = () => {
        this.props.fanhui()
        request({
            url: '/pm-web/projectmanage/subeventsbasicinfo/deleteByEventBasicInfoId',
            method: 'POST',
            data: { eventBasicId: this.state.eventBasicId }
        }).then(data => { })

    }


    //删除风险信息
    onDelete = (inx) => {
        // console.log(inx)
        this.state.arr[7].list.forEach((item, index) => {
            if (item.index === inx) {
                // console.log(item)
                item.disabled = true//设置不可编辑
                item.rules = null//去除必填校验
                // this.state.arr[10].list.splice(index, 3)
                //将删除的风险信息放入数组
                fengxianArr.push(inx)

            }
        })

        this.setState({
            arr: this.state.arr
        })
    }
    //恢复风险信息
    onHuifu = (inx) => {
        //对风险信息对标进行去重
        fengxianArr = Array.from(new Set(fengxianArr))
        //删除已经恢复的风险信息
        Array.prototype.remove = function (val) {
            var index = this.indexOf(val);
            if (index > -1) {
                this.splice(index, 1);
            }
        };
        fengxianArr.remove(inx);
        // console.log(fengxianArr)
        this.state.arr[7].list.forEach((item, index) => {
            if (item.index === inx) {
                // console.log(item)
                item.disabled = false//恢复至可编辑状态
                item.rules = [{ ...config.reg.required }]//设置必填校验

            }
        })



        this.setState({
            arr: this.state.arr
        })
    }


    render() {
        let t = this
        let width = document.body.clientWidth;
        // console.log(width)
        const height = document.body.clientHeight;
        let containerHeight = '76vh';
        let tableHeight = 310;
        if (width > 1367) {
            tableHeight = 380;
            containerHeight = '83vh';
        }
        const {  selectedRowKeys, spanLoading } = this.state;
        let { getFieldDecorator } = this.props.form;
        const genExtra = () => (

            <span onClick={this.onDelete} style={{ color: 'red' }}>删除</span>
        );

        return (

            <div className={styles.addWrap}  >

                <div className={styles.warpBox}>
                    <div className={styles.Top_BoxAdd}>
                        <span style={{ fontSize: 24, marginLeft: 10 }}>新增事件</span>
                        <div style={{ paddingRight: 20, width: '60%' }}>
                            <Steps size="small" current={1}>
                                <Step title="创建模板" />
                                <Step title="填写模板信息" />
                                <Step title="完成模板" />
                            </Steps>
                        </div>

                        {/* <Icon type="close-circle" theme="twoTone" twoToneColor="red" onClick={this.fanhui} style={{ marginRight: 10, cursor: 'pointer' }} /> */}
                    </div>
                    <div style={{ backgroundColor: '#fff', overflow: 'auto', paddingBottom: 20 }} >

                        <Form layout={'inline'} style={{ paddingLeft: 40, paddingRight: 40 }} >
                            <Row gutter={48} key={55555}>
                                {
                                    this.state.arr.map((item, index) => {
                                        if (item.type === 'TextArea') {
                                            return (
                                                <Col span={item.span || 8} key={index} className={item.className}>
                                                    <Form.Item label={item.label} key={item.paramName}>
                                                        {
                                                            getFieldDecorator(item.paramName, {
                                                                initialValue: item.initialValue ? item.initialValue : '',
                                                                rules: item.rules || null
                                                            })(
                                                                <Tooltip
                                                                    trigger={['focus']}
                                                                    title={item.title}
                                                                    placement="topLeft"
                                                                    overlayClassName="numeric-input"
                                                                >
                                                                    <TextArea
                                                                        style={item.style}
                                                                        placeholder={item.placeholder || '请输入'}
                                                                        // onChange={this.onChange}
                                                                        className={item.shuoming}
                                                                        rows={item.rows}
                                                                        maxLength={item.num}
                                                                        disabled={item.disabled} id={[item.paramName]}
                                                                        onChange={this.getChangeValue.bind(this, item.paramName)} size={config.size}
                                                                    />
                                                                </Tooltip>
                                                            )
                                                        }
                                                    </Form.Item>
                                                </Col>
                                            )
                                        } else if (item.type === 'select') {
                                            return (
                                                <Col span={8} key={index}>
                                                    <Form.Item label={item.label} key={item.paramName} className={item.className} >
                                                        {
                                                            getFieldDecorator(item.paramName, {
                                                                initialValue: item.initialValue ? item.initialValue : (item.options[0] ? Util.numToString(item.options[0].value) : item.options[0]),
                                                                rules: item.rules || null
                                                            })(
                                                                <Select
                                                                    size={config.size}
                                                                    showSearch
                                                                    style={item.style}
                                                                    mode={item.mode}
                                                                    placeholder="Select a person"
                                                                    className={item.shuoming}
                                                                    optionFilterProp="children"
                                                                    dropdownMatchSelectWidth={t.props.dropdownMatchSelectWidth}
                                                                    onChange={t.selectedChange.bind(t, item.selectChange, item.nextParamName || false, item.paramName)}
                                                                    onSelect={item.onSelect}
                                                                    disabled={item.disabled}
                                                                >
                                                                    {
                                                                        item.options.map(option => {
                                                                            return (
                                                                                <Select.Option key={option.value}
                                                                                    value={Util.numToString(option.value)}
                                                                                >
                                                                                    {option.text}
                                                                                </Select.Option>

                                                                            )
                                                                        })
                                                                    }
                                                                </Select>
                                                            )
                                                        }
                                                    </Form.Item>
                                                </Col>
                                            )
                                        } else if (item.type === 'treeSelect') {
                                            return (
                                                <Col span={item.span || 8} key={index}>
                                                    <Form.Item label={item.label} key={item.paramName} className={item.className} >
                                                        {
                                                            getFieldDecorator(item.paramName, {
                                                                initialValue: item.initialValue ? item.initialValue : null,
                                                                rules: item.rules || null
                                                            })(
                                                                <TreeSelect
                                                                    treeData={item.treeData}
                                                                    onChange={t.selectedChange.bind(t, item.selectChange, item.nextParamName || false, item.paramName)}
                                                                    treeCheckable={item.treeCheckable}
                                                                    showCheckedStrategy={SHOW_CHILD}
                                                                    // searchPlaceholder={'请选部门'}
                                                                    style={item.style}
                                                                    maxTagCount={item.maxTagCount}
                                                                />
                                                            )
                                                        }
                                                    </Form.Item>
                                                </Col>
                                            )
                                        } else if (item.type === 'title') {
                                            return (


                                                <Col span={item.span || 8} key={index} style={{ paddingLeft: 0, paddingRight: 0, height: item.height, marginBottom: 15 }}>
                                                    {/* <div style={{ width: "100%", borderBottom: "5px solid #423578",marginBottom:10 }}></div> */}
                                                    <h2 style={{ fontSize: 14, fontWeight: 700, position: 'relative', marginBottom: 0, marginTop: item.marginTop, marginBottom: 5, backgroundColor: '#F5F6F7' }}><span style={{ padding: 1, color: "#fff", backgroundColor: item.backgroundColor, position: 'absolute', left: '-15px', width: 5, height: 20 }}> </span><span style={{ color: item.color }}>{item.name}</span></h2>


                                                </Col>


                                            )
                                        } else if (item.type === 'arr') {
                                            return (
                                                item.list.map((item, index) => {
                                                    if (item.type === 'TextArea') {
                                                        return (
                                                            <Col span={item.span || 8} key={index}>
                                                                <Form.Item label={item.label} key={item.paramName} className={item.className} >
                                                                    {
                                                                        getFieldDecorator(item.paramName, {
                                                                            initialValue: item.initialValue ? item.initialValue : '',
                                                                            rules: item.rules || null
                                                                        })(
                                                                            <Tooltip
                                                                                trigger={['focus']}
                                                                                title={item.title}
                                                                                placement="topLeft"
                                                                                overlayClassName="numeric-input"
                                                                            >
                                                                                <TextArea
                                                                                    style={item.style}
                                                                                    placeholder={item.placeholder}
                                                                                    className={item.shuoming}
                                                                                    // onChange={this.onChange}
                                                                                    rows={item.rows}
                                                                                    maxLength={item.num}
                                                                                    disabled={item.disabled} id={[item.paramName]}
                                                                                    onChange={this.getChangeValueList.bind(this, item.paramName)} size={config.size} style={item.style}
                                                                                />
                                                                            </Tooltip>
                                                                        )
                                                                    }
                                                                </Form.Item>
                                                            </Col>
                                                        )
                                                    } else if (item.type === 'delete') {
                                                        return (
                                                            <Col span={22} key={index} xxl={{ push: 2 }} style={{ textAlign: 'right', height: 20 }} push={2}>
                                                                <IconFont type="icon-suoding" onClick={this.onDelete.bind(this, item.index)} style={{ fontSize: 16, cursor: 'pointer', width: 20, height: 20, color: 'red' }} />
                                                                <IconFont type="icon-jiesuo" onClick={this.onHuifu.bind(this, item.index)} style={{ fontSize: 16, cursor: 'pointer', width: 20, height: 20, color: 'green' }} />
                                                                {/* <button onClick={this.onDelete.bind(this, item.index)}>删除</button> */}
                                                            </Col>
                                                        )
                                                    }

                                                })


                                            )
                                        } else if (item.type === 'button') {
                                            return (
                                                <Col span={2} key={index} xxl={{ pull: 0 }} style={{ textAlign: 'right', height: 20, width: 2 }} pull={1}>

                                                    <IconFont type="icon-xinzeng" onClick={this.addListfx} style={{ fontSize: 16, cursor: 'pointer', width: 20, height: 20, color: '#16B8BD' }} />
                                                </Col>
                                            )
                                        }

                                    })
                                }

                            </Row>
                        </Form>
                        {/* 子事件区域 */}
                        {
                            this.state.eventBasicId && <AddEvent
                                eventBasicId={this.state.eventBasicId}
                                getTreeDataAn={this.state.getTreeDataAn}
                            />
                        }
                    </div>


                    <div className={styles.Bottom_Box}>
                        <Button onClick={this.onModalSave} loading={spanLoading} style={{ color: '#fff', width: 136, height: 32, background: 'rgba(0,171,187,1)', borderRadius: 14, textAlign: 'center', lineHeight: '32px', cursor: 'pointer' }}>保存</Button>


                        <div style={{ color: 'red', width: 136, height: 32, background: '#fff', borderRadius: 14, textAlign: 'center', lineHeight: '32px', border: '1px solid #ccc', cursor: 'pointer' }} onClick={this.fanhui}>关闭</div>
                    </div>

                </div>

            </div>

        );


    }
}
export default Form.create()(Add_Wrap);

